USB controlling apparatus for data transfer between computers and method for the same

ABSTRACT

A USB controlling apparatus for data transfer between computers and method for the same are provided. The apparatus comprises a host controller providing a host function of USB interface; a device function circuit providing a device function of USB interface; at least one connection for connecting to a USB device or a USB cable by way of data transfer; and a path switch unit. The path switch unit connected to the host controller, device function circuit and the USB data lines, used to switch a connection path of the USB data lines between the host controller and the device function circuit, which is able to provide a host function mode to connect USB apparatus for data transmitting or a device function mode to connect with other computer host for data transmitting.

FIELD OF THE INVENTION

[0001] The present invention relates to a USB controlling apparatus and method for the same, more particularly to a USB controlling apparatus for data transfer between computers and method for the same, the USB controlling apparatus being provided with a device function circuit and a path switch to enable a computer to have both host and device function.

BACKGROUND OF THE INVENTION

[0002] USB (universal serial bus) interface allows for plug-and-play function, up to 127 physical devices connection, provision of 5V electrical power and requires only one IRQ. Therefore, USB becomes standard interface for nowadays computer. Moreover, the USB 2.0 can provide high data transfer rate of 480 Mbps and is feasible for higher-performance peripheral such as scanners, printers and storage devices.

[0003] The conventional ways of data transfer between computers rely on cable connected between printer ports of computers or connected between network interfaces cards of computers. However, the data transfer rate is low by above conventional ways and network interfaces card is required for latter approach. As the prevailing of USB interface, it is proposed to use USB interface for data transfer between computers.

[0004] The USB interface is functioned with the master/slave architecture. Therefore, the data transfer between a computer and a peripheral can be established only after the computer is recognized to be a host and the peripheral is recognized to be a device.

[0005] To provide data transfer between computers through USB interface, a USB bridge 16 is provided between two computers 12 and 18, as shown in FIG. 1. The USB bridge 16 is connected to a host controller 123 of the computer 12 through a USB cable 141, and connected to a host controller 183 of the computer 18 through a USB cable 143. In this scheme, both of the computers 12 and 18 provide host function and the USB bridge 16 provides device function to establish data transfer between the two computers 12 and 18.

[0006] In above approach, one USB bridge and two USB cables are required to achieve data transfer between two computers. It costs higher expense and is inconvenient for user.

[0007] Moreover, the USB bridge is further modified to incorporate into a USB cable. However, the USB cable with bridging function has higher cost and cannot be used for data transfer between computer and peripheral.

SUMMARY OF THE INVENTION

[0008] It is the object of the present invention to provide a USB controlling apparatus for data transfer between computers, wherein the computer using the USB controlling apparatus has both host function and device function.

[0009] In one aspect of the present invention, the USB controlling apparatus has a device function circuit to provide a device function for USB interface of a computer. The computer can communicate data with another computer through the USB controlling apparatus.

[0010] In another aspect of the present invention, the USB controlling apparatus has a path switch to switch a path to the device function circuit or a host controller. Therefore, a computer using the USB controlling apparatus can transfer data to a peripheral or another computer.

[0011] In still another aspect of the present invention, the USB controlling apparatus has a power switch, a pull-up resistor and a pull-up switch, which are turned on/off during device function mode or host function mode of a computer using the USB controlling apparatus. Therefore, the connection status of the computer with a peripheral or another computer can be sensed.

[0012] In still another aspect of the present invention, the device function mode or the host function mode of a computer using the USB controlling apparatus can be manually or automatically set.

[0013] In still another aspect of the present invention, a predetermined waiting time is set for limiting a time duration to check connection status of the computer with a peripheral or another computer. The computer is automatically and alternatively switched to device function mode or host function mode if the connection is not established within the predetermined waiting time.

[0014] The various objects and advantages of the present invention will be more readily understood from the following detailed description when read in conjunction with the appended drawing, in which:

BRIEF DESCRIPTION OF DRAWING

[0015]FIG. 1 shows a schematic diagram of a prior art USB interface for data transfer between computers;

[0016]FIG. 2 shows a schematic diagram of a first preferred embodiment of the present invention;

[0017]FIG. 3 shows a schematic diagram of a second preferred embodiment of the present invention; and

[0018]FIG. 4 shows a flowchart of the method according to the present invention.

DETAILED DESCRIPTION OF THE INVENTION

[0019]FIG. 2 shows a schematic diagram of a first preferred embodiment of the present invention. The USB control apparatus according to this preferred embodiment is implemented into a controller chip 20. The controller chip 20 comprises a host controller 22 with a USB interface, a device function circuit 24, a path switch 26 and a connection port 25. The connection port 25 comprises at least one set of data lines (data line D₊ 253 and data line D⁻ 255) for data transfer. The path switch 26 is connected to the host controller 22, the device function circuit 24 and the data line D₊ 253 and D⁻ 255 of the connection port 25. The path switch 26 is functioned to switch a connection path of the connection port 25 between the host controller 22 and the device function circuit 24 when the controller chip 20 is to be switched between a host function mode and a device function mode.

[0020] The connection port 25 further comprises a power adapting line 251 with a power switch 28. The power adapting line 251 is connected to the data line D₊ 253 through a pull-up resistor 291 and a pull-up switch 293 in serial connection. The power adapting line 251 is further connected to a USB power line 231 on motherboard to feed electric power to the controller chip 20. The power adapting line 251, together with the data line D₊ 253, the data line D⁻ 255 and a ground line 233 of the motherboard, provides USB connection to a peripheral USB device or another computer.

[0021] The power switch 28 is turned on and the pull-up switch 293 is turned off when the connection path of the connection port 25 is switched to the host controller 22 by the path switch 26. At this time, the USB interface of the controller chip 20 is operated in the host function mode and has data transfer with a peripheral USB device. The power switch 28 is turned off and the pull-up switch 293 is turned on when the connection path of the connection port 25 is switched to the device function circuit 24 by the path switch 26. At this time, the USB interface of the controller chip 20 is operated in the device function mode and has data transfer with another computer.

[0022]FIG. 3 shows a schematic diagram of a second preferred embodiment of the present invention. The controller chip 20 has similar components as those shown in FIG. 2 except that a power switch 385 is arranged at the USB power line 231 on the motherboard end. Moreover, the connection port 25 further has a power switch controller 38 with input nodes connected to the USB power line 231 and the pull-up resistor 291, respectively, such that the connection port 25 is selectively connected to peripheral USB device and another computer. The power switch controller 38 has output node connected to the power switch 385 to control the turning on/off of the power switch 385.

[0023] In above-mentioned embodiments, the path switch 26 can be implemented by a multiplexer, while the power switch 28 and the pull-up switch 293 can be implemented by transistor circuit.

[0024]FIG. 4 shows a flowchart according the method of the present invention. The connection path of the connection port 25 can be switched either in manual operation or automatic operation according to this method.

[0025] As shown in FIG. 4, in automatic operation, the default data transfer mode is set to be host function mode in step 301. Moreover, the connection port is switched to the host controller by the path switch, the power switch is turned on and the pull-up switch is turned off in step 301. The process passes next to step 303 for judging whether the connection port is used. If true, the host function mode is sustained and the computer using the controller chip accesses a peripheral device in the host function mode in step 343, else the operation mode of the controller chip is switched to a device function mode in step 305. In step 305, the connection port is switched to the device function circuit by the path switch, the power switch is turned off and the pull-up switch is turned on such that the USB interface of the controller chip is operated as device and to be established connection with another computer.

[0026] After step 305, the connection condition of the controller chip to another computer is examined in step 307. If connection is established, the controller chip is functioned as a device connected to another computer and has data transfer with another computer in step 327, else the controller chip keeps waiting and the elapsed time is examined in step 309. If the connection is established in elapsed time within a predetermined time limit, the controller chip is operated in the device function mode and has data transfer with another computer, else the controller chip is switched to host function mode in step 311.

[0027] Similarly, in step 313 after step 311, the connection condition of the controller chip to the peripheral device is examined. If the connection is established, the controller chip is functioned as a host connected to the peripheral device and has data transfer with the peripheral device in step 343, else the controller chip keeps waiting and the elapsed time is examined in step 315. If the connection is established in elapsed time within the predetermined time limit, the controller chip is operated in the host function mode and has data transfer with the peripheral device, else the controller chip is switched to device function mode in step 305 and the connection condition is kept examining in succeeding step 307.

[0028] The predetermined waiting time limit can be set according to user's requirement. When the computer using the controller chip is operated in host function mode, the detection of connection condition is performed in ordinary detection way.

[0029] The above-mentioned preferred embodiments are exemplified with USB 2.0 version (high speed bus) or full speed version of USB 1.1. However, the present invention can also be applied to low speed version, i.e., USB 1.1 as long as another pull-up resistor and pull-up switch are provided between the power adapting line 251 and the data line D⁻ 255 and the switch is controlled to turn on/off by software or firmware.

[0030] Although the present invention has been described with reference to the preferred embodiment thereof, it will be understood that the invention is not limited to the details thereof. Various substitutions and modifications have suggested in the foregoing description, and other will occur to those of ordinary skill in the art. Therefore, all such substitutions and modifications are intended to be embraced within the scope of the invention as defined in the appended claims. 

What is claimed is:
 1. A USB controlling apparatus adapted for data transfer between computers, said USB controlling apparatus comprising a host controller providing a host function of USB interface for said USB controlling apparatus; a device function circuit providing a device function of USB interface for said USB controlling apparatus; at least one connection port having a set of USB data lines D+ and D− for connecting to a USB device or a USB cable by way of data transfer; and a path switch unit connected to said host controller, said device function circuit and said USB data lines, used to switch a connection path of said USB data lines between said host controller and said device function circuit.
 2. The USB controlling apparatus as in claim 1, further comprising a power adapting line with a power switch, having one end connected to a power line on a motherboard and another end connected to USB device and USB cable.
 3. The USB controlling apparatus as in claim 2, further comprising a series connection of a pull-up resistor and a pull-up switch crossing between said power adapting line and said data line D+.
 4. The USB controlling apparatus as in claim 1, wherein said path switch unit is a multiplexer.
 5. The USB controlling apparatus as in claim 2, wherein said power switch is transistor circuit.
 6. The USB controlling apparatus as in claim 3, wherein said pull-up switch is transistor circuit.
 7. The USB controlling apparatus as in claim 3, wherein said path switch is operated in one of manual operation and automatic operation.
 8. The USB controlling apparatus as in claim 3, wherein said power switch is turned on and said pull-up switch is turned off when said connection path of said path switch is connected to said host controller.
 9. The USB controlling apparatus as in claim 3, wherein said power switch is turned off and said pull-up switch is turned on when said connection path of said path switch is connected to said device function circuit.
 10. The USB controlling apparatus as in claim 2, further comprising a series connection of another pull-up resistor and another pull-up switch crossing between said power adapting line and said data line D−.
 11. The USB controlling apparatus as in claim 1, further comprising a power switch arranged at a USB power line on a motherboard, said connection port having a power switch controller with output node connected to said power switch in order to turn on and off said power switch.
 12. The USB controlling apparatus as in claim 11, further comprising a pull-up resistor and a pull-up switch in serial connection, said pull-up resistor having one end connected to said power switch and said USB power line, said pull-up switch having one end connected to said data line D+.
 13. The USB controlling apparatus as in claim 12, wherein said power switch and said pull-up switch are transistor circuit.
 14. A method for said USB controlling apparatus as in claim 3, said method comprising following steps: setting a host function mode as a default operation mode of said USB controlling apparatus; detecting whether said connection port is used; when said connection port is used, said USB controlling apparatus is operated in said host function mode; when said connection port is not used, said USB controlling apparatus is switched to operate in a device function mode.
 15. The method as in claim 14, wherein said data lines are connected to said host controller by said path switch, said power switch is turned on and said pull-up switch is turned off when said USB controlling apparatus is operated in said host function mode.
 16. The method as in claim 14, wherein said data lines are connected to said device function circuit by said path switch, said power switch is turned off and said pull-up switch is turned on when said USB controlling apparatus is operated in said device function mode.
 17. The method as in claim 14, further comprising following steps: providing a predetermined waiting time; detecting whether a connection is established for said USB controlling apparatus; when said connection is established, said USB controlling apparatus is operated in said device function mode; when said connection is not established, examining whether said connection is established within said predetermined waiting time.
 18. The method as in claim 17, further comprising following steps: operating said USB controlling apparatus in said device function mode if said connection is established within said predetermined waiting time; else switching said USB controlling apparatus to said host function mode if said connection is not established within said predetermined waiting time.
 19. The method as in claim 18, further comprising following steps: detecting whether a connection is established for said USB controlling apparatus; if true, said USB controlling apparatus is operated in said host function mode; else examining whether said connection is established within said predetermined waiting time; operating said USB controlling apparatus in said host function mode when said connection is established within said predetermined waiting time; switching said USB controlling apparatus to said device function mode when said connection is not established within said predetermined waiting time.
 20. The method as in claim 17, wherein said predetermined waiting time is a user-defined value. 